<template>
  <dt-modal-edit ref="edit" title="提示" @ok="onOk" @cancelData='cancelData'>
    <div>
      <div class="resonText">
        强制结束后，该账号将无法再通过隐私号拨打电话<br>并且租期剩余天数和通话时间都会清零，该操作不可恢复。
      </div>
      <Input v-model="reson" maxlength="300" show-word-limit type="textarea"
        placeholder="请填写结束原因" :rows="4" />
    </div>
  </dt-modal-edit>
</template>
<script>
  import receiverMgr from '@/biz/receiver/receiver'
  export default {
    data() {
      return {
        info: null,
        reson: ''
      }
    },

    methods: {

      onOk() {
        if (this.reson == '') {
          this.$Message.warning('请输入强制结束原因')
          return false
        }
        let params = {
          endReason: this.reson,
          privateType: "COERCEEND",
          userId: this.info && this.info.userId
        }
        receiverMgr.coerceEnd(params).then((res) => {
          this.$emit("dataRefresh")
          this.$refs.edit.hide()

        })
      },
      cancelData() {
        this.info = null,
          this.reson = ''
      },
      show(val) {
        this.info = val
        this.$refs.edit.show()
      },

    }

  }
</script>


<style lang="scss" scoped>
  .resonText {
    line-height: 1.8;
    padding: 20px 0;
  }
</style>